function cache(key, val) {
	if (!val) {
		return JSON.parse((localStorage.getItem(key) || "{}")).val;
	}
	localStorage.setItem(key, JSON.stringify({ val }));
}

function session(key, val) {
	if (!val) {
		return JSON.parse((sessionStorage.getItem(key) || "{}")).val;
	}
	sessionStorage.setItem(key, JSON.stringify({ val }));
}

export default {
  session,
  cache
}
